
package com.serv;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tom.User;

@WebServlet("/HelloServee")
public class HelloServee extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
    public HelloServee() {
        super();
      
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		
		response.setContentType("text/html");
		PrintWriter pw = response.getWriter();
	 String name =request.getParameter("name");
	 String email =request.getParameter("email");
	 String id =request.getParameter("id");
	 String password =request.getParameter("password");
	 
	 pw.print("<B> Hello  :) </br></B>");
	
		pw.print("</br>" +"<b>First name :</B>" +name);
		pw.print("</br>"+ "<b>Email :</B>" +email);
		pw.print("</br>"+" <b>Id :</B>" +id);
		pw.print("</br>"+" <b>Password :</B>" +password);
		
		User u1 = new User(name,email,id,password);
		boolean b=u1.saveUser();
		
		if(b==true){
			 pw.print("</br>"+"<B>User saved successfully");
		 }
		else { pw.print("</br>"+"insert unsuccessfull");}
		 
		
	   // User u2 = new User("aks","aa@gmail.com","24","aaaaa");
       //	u2.saveUser();
		 
String v="CHANDINI";

boolean b1=u1.update(v,"12");

if(b1==true){
 			pw.print("</br>"+"<B>User updated successfully");	

 		}
else{ pw.print("</br>"+"update unsuccessfull");}
	}
	}



